import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;

public class bai4 {
	static ArrayList<String> A;
	static String B = "ZER ONE TWO THR FOU FIV SEX SEV EIH NIN";
 
	public static void main(String[] args) throws FileNotFoundException {
		Scanner sc = new Scanner(System.in);
		sc = new Scanner(new FileInputStream("input4.txt"));
		for (int test_case = 1; test_case <= 1; test_case++) {
			A = new ArrayList<String>();
			while (sc.hasNext()) {
				A.add(sc.next());
			}
			System.out.println(A.size());
			
			A.sort(new Comparator<String>() {
				@Override
				public int compare(String o1, String o2) {
					if(B.indexOf(o1) == B.indexOf(o2))
						return 0;
					if(B.indexOf(o1) > B.indexOf(o2))
						return 1;
					return -1;
				}
			});
			
			System.out.println("#" + test_case + " "+A.toString());
			for (int i = 0; i < A.size(); i++) {
				System.out.print(A.get(i)+" ");
			}

		}
	}

}
